package com.guang.countdownlatch;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.nio.ch.ThreadPool;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @Description
 * @Author liguang
 * @Date 2023/06/20/20:39
 */
public class WangZheNongYaoTest {

    private static Logger logger = LoggerFactory.getLogger(WangZheNongYaoTest.class);

    public static void main(String[] args) {
        CountDownLatch countDownLatch = new CountDownLatch(10);
        for (int i = 0; i < 10; i++) {
            new Thread(()->{
                logger.info("当前线程开始加载游戏");
                logger.info("进行网络连接");
                countDownLatch.countDown();
            },"t"+(i+1)).start();
        }

        try {
            countDownLatch.await();
            logger.info("全部加载完毕，开始游戏");
            logger.info("欢迎来到王者荣耀");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }


}
